#pragma once

#include <iostream>
#include <functional>

// typedef std::function<void()> task_t;
using task_t = std::function<void()>;//返回值是void参数为空的函数对象，类似于一个类，因为底层是仿函数

// void Download()
// {
//     std::cout << "我是一个下载的任务" << std::endl;
// }

class Task
{
public:
    Task()
    {
    }
    Task(int x, int y) : _x(x), _y(y)
    {
    }
    // 做加法
    void Excute()
    {
        _result = _x + _y;
    }
    void operator()()
    {
        Excute();
    }
    std::string debug()
    {
        std::string msg = std::to_string(_x) + "+" + std::to_string(_y) + "=?";
        return msg;
    }
    std::string result()
    {
        std::string msg = std::to_string(_x) + "+" + std::to_string(_y) + "=" + std::to_string(_result);
        return msg;
    }

private:
    int _x;
    int _y;
    int _result;
};